﻿// -----------------------------------------------------------------------
// Copyright (c) David Kean. All rights reserved.
// -----------------------------------------------------------------------
extern alias pcl;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using pcl::System.Security.Cryptography;
using pcl::System.Security.Cryptography.Adaptation;

namespace Portable.Security.Cryptography
{
    [TestClass]
    public class KeyedHashAlgorithmTests
    {
        [TestMethod]
        public void Constructor_SetsUnderlyingAlgorithmKeyToKey()
        {
            byte[] result = null;
            var underlyingAlgorithm = new Mock<IKeyedHashAlgorithm>();
            underlyingAlgorithm.Setup(m => m.SetKey(It.IsAny<byte[]>()))
                               .Callback<byte[]>(value => { result = value; });

            byte[] key = new byte[100];
            new KeyedHashAlgorithm(underlyingAlgorithm.Object, key);

            Assert.AreSame(result, key);
        }
    }
}
